/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.uoc.tfc.exuoc.model;

import java.util.Date;

import edu.uoc.tfc.exuoc.config.Config;
/**
 *
 * @author emoreno
 */
public class Sessio {
    private String id=Config.valorNullStr;
    private String login="";
    private Boolean isAdmin=false;
    private Boolean isGestor=false;
    private Boolean isLogin=false;
    private Date dataInici=null;

    public Sessio() {
    }

    public Sessio(String _id) {
        this.dataInici=new Date();
        this.id=_id;
        this.isAdmin=false;
        this.isGestor=false;
        this.isLogin=false;
        this.login=Config.valorNullStr;
    }


    public Sessio(String _id, String _login) {
        this.dataInici=new Date();
        this.id=_id;
        this.isAdmin=false;
        this.isGestor=false;
        this.isLogin=false;
        this.login=_login;
    }

    public Sessio(String _id, String _login,Boolean _admin, Boolean _gestor, Boolean _islogin) {
        this.dataInici=new Date();
        this.id=_id;
        this.isAdmin=_admin;
        this.isGestor=_gestor;
        this.isLogin=_islogin;
        this.login=_login;
    }


    public Date getDataInici() {
        return dataInici;
    }

    public void setDataInici(Date dataInici) {
        this.dataInici = dataInici;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Boolean getIsAdmin() {
        return isAdmin;
    }

    public void setIsAdmin(Boolean isAdmin) {
        this.isAdmin = isAdmin;
    }

    public Boolean getIsGestor() {
        return isGestor;
    }

    public void setIsGestor(Boolean isGestor) {
        this.isGestor = isGestor;
    }

    public Boolean getIsLogin() {
        return isLogin;
    }

    public void setIsLogin(Boolean isLogin) {
        this.isLogin = isLogin;
    }

    public String getLogin() {
        return login;
    }

    public void setLogin(String login) {
        this.login = login;
    }
    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Sessio other = (Sessio) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        /*if ((this.login == null) ? (other.login != null) : !this.login.equals(other.login)) {
            return false;
        }*/
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 23 * hash + (this.id != null ? this.id.hashCode() : 0);
        hash = 23 * hash + (this.login != null ? this.login.hashCode() : 0);
        hash = 23 * hash + (this.isAdmin != null ? this.isAdmin.hashCode() : 0);
        hash = 23 * hash + (this.isGestor != null ? this.isGestor.hashCode() : 0);
        hash = 23 * hash + (this.isLogin != null ? this.isLogin.hashCode() : 0);
        hash = 23 * hash + (this.dataInici != null ? this.dataInici.hashCode() : 0);
        return hash;
    }

    @Override
    public String toString() {
        return this.getId()+";"+this.getLogin()+";"+
                                            this.getDataInici().toString();
    }



}
